import { add, minus, asyncAdd } from '../../actions/counter'

import { View, Button, Text } from '@tarojs/components'
import { useDispatch, useSelector } from "react-redux";
import { } from "react";

import './index.scss'

const Index = (props) => {
  const dispatch = useDispatch();
  const { counter: { num } } = useSelector(s => s);

  return (
    <View className='index'>
      <Button className='add_btn' onClick={() => dispatch(add())}>+</Button>
      <Button className='dec_btn' onClick={() => dispatch(minus())}>-</Button>
      <Button className='dec_btn' onClick={() => dispatch(asyncAdd())}>async</Button>
      <View><Text>{num}</Text></View>
      <View><Text>Hello, World</Text></View>
    </View>
  )
};


export default Index


